Skip to content

Update CopyArrayElements to .NET 10 with span and collection expression copies - #2364

Merged
vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/64639-csharp-copy-array-elements-to-new-array
Nov 10, 2026
Merged

vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/64639-csharp-copy-array-elements-to-new-array

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Moves all three projects in collections-arrays/CopyArrayElements to net10.0 with BenchmarkDotNet 0.15.8, MSTest 4.5.2, Microsoft.NET.Test.Sdk 18.11.0 and coverlet.collector 10.1.0, and drops the unused BenchmarkDotNet reference from the console app. ElementCopier gains partial copies with Array.Copy, a range and a span, plus span, collection expression and ToArray copies, each covered by a test, and the sample now shows that a shallow copy shares its elements. The benchmark measures 1,000 and 10,000 elements with a memory diagnoser, returns every copy so the work is not optimised away, and passes its arguments to BenchmarkSwitcher.

@vladimir-pecanac-main
vladimir-pecanac-main merged commit 25c38ae into CodeMazeBlog:main Nov 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant